home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / idle / autolog-.000 / autolog- / autolog-0.31 / README < prev   
Text File  |  1995-08-19  |  9KB  |  233 lines

  1. Autolog 0.30
  2.  
  3. Autolog is a version of autologout (idleout-mcm) modified by me to allow
  4. a more detailed configuration file, and to accept command line parameters.
  5. According to David Dickson, the code originally came from the "Wizard's
  6. Grabbag" from the May 1990 Unix World.  He ported the code essentially
  7. unchanged.
  8.  
  9. Mike Mitchell added some code to read a file "/etc/autologout.exempt"
  10. listing those users which should not be subject to auto logout.
  11.  
  12. My system required a little more complex approach.  I wanted some
  13. users to be logged off more aggressively than others.  I wanted my own
  14. sessions to remain on line only if they existed on certain ports.
  15. I also wanted users coming in over the net to be subject to a little
  16. different idle time than other users.
  17.  
  18. After doing version 0.20, several people wrote with various additions
  19. and patches.  The problem was that the original syntax of the autolog.conf
  20. file was a bit limiting and it was hard to work in too many additional
  21. features without making a big fat mess.  With the new, improved format
  22. of the configuration file, I should be able to accomodate many more 
  23. future features.
  24.  
  25. The configuration file consists of multiple lines, each of which describes
  26. a class of processes subject (or not subject) to a certain auto logout
  27. procedure.  A line consists of any number of switches.  Value switches are
  28. of the form: "name=value".  Boolean switches are of the form: "name" or
  29. "noname".  Here are some example lines:
  30.  
  31.     name=root line=tty[1-7] idle=0
  32.     name=guest idle=5 grace=60 nomail hard warn
  33.     group=lynx-.* idle=10 grace=60 clear
  34.     idle=60 grace=30
  35.  
  36. Using these switches, you can define a username, a group, and a tty line.
  37. These descriptions can contain wildcard characters (regular expressions).
  38. You can also define an idle time, a grace period and a few other options.
  39. When reading the configuration file, the program creates a record for each
  40. configuration line.  A value is assigned to each variable in the record
  41. regardless of whether or not you specify one explicitly.  Values for 
  42. missing variables are provided by defaults which are compiled in and can 
  43. be modified from the command line.
  44.  
  45. If no configuration file is found, the program will create a single
  46. entry which has all values set from the defaults.  This entry will match 
  47. any process on any port (name=.* line=.* group=.*).  Therefore, the default
  48. action is to kill all processes.
  49.  
  50. The values which can be set for each entry are as follows:
  51.  
  52.     name=
  53.         A regular expression specifying which username(s) to match.
  54.     group=
  55.         A regular expression specifying which group(s) to match.
  56.     line=
  57.         A regular expression specifying which tty line(s) to match.
  58.         Omit the "/dev/" part of the special name.
  59.     idle=
  60.         An integer specifying the number of minutes of idle
  61.         (or connect) time to allow before beginning automatic logoff.
  62.         An idle time of 0 exempts the process from automatic logoff.
  63.     grace=
  64.         An integer specifying the number of seconds from the initial
  65.         warning to killing the process.
  66.     hard
  67.         A boolean value indicating total connect time will be 
  68.         considered rather than idle time.
  69.     mail
  70.         A boolean value indicating that mail will be sent to the
  71.         user explaining that he was killed.
  72.     clear
  73.         A boolean value indicating that the screen will be cleared
  74.         before a warning message is sent.
  75.     warn
  76.         A boolean value indicating that a warning message will be
  77.         sent at the beginning of the "grace" period.
  78.     log
  79.         A boolean value indicating that activities will be logged
  80.         to the logfile (if it exists).
  81.  
  82. Once configured, the program reads the utmp file, entry by entry.  The 
  83. username for each 'user process' is compared to the entries in the 
  84. configuration file.  The first entry to match both the name, the group,
  85. and the tty line of the process will be used to conduct the automatic 
  86. logout.  
  87.  
  88. If no entries are found matching a given process, that process will be
  89. spared from an untimely demise.  Therefore, it is a good idea to always 
  90. have a "cleanup" line at the end of the configuration file to catch 
  91. anything that might have been missed by the more explicit definitions.  
  92. Since the default name, group, and line are all ".*", a simple line like:
  93.  
  94.     idle=30
  95.  
  96. will do.  Actually, any one switch can be specified on the line and all the
  97. others will get the default values.
  98.  
  99. See the sample file autolog.conf for an example configuration.
  100.  
  101. Installation Instructions:
  102.  
  103.     1.    If desired, edit the defaults in autolog.c such as
  104.         D_IDLE, D_GRACE, D_MAIL, etc.  (This is generally not
  105.         necessary).
  106.         
  107.         If you want the binary to land somewhere besides 
  108.         /usr/sbin, edit the Makefile accordingly.
  109.     
  110.     2.    Type 'make install'.
  111.     
  112.     3.    Copy autolog.conf to /etc and then edit it to make the
  113.         changes needed by your system.  (See the instructions
  114.         above.)
  115.     
  116.     4.    Wait until the system has a bunch of idle processes.
  117.         Run "autolog -d -n |less" and examine the output to see
  118.         that the desired processes are going to "get the axe."
  119.         If it looks good, try running "autolog -d" to make sure.
  120.         When you're happy with your configuration file, setup cron.
  121.     
  122.     5.    In your Crontab file place a line that invokes
  123.         autolog about every few minutes, such as:
  124.         
  125.         0,10,20,30,40,50 * * * * /usr/sbin/autolog
  126.         
  127.         On my system cron only runs the process at night.
  128.         This way, users sessions stay on uninterrupted during the 
  129.         workday.  I use the lines:
  130.  
  131.         0 20 * * * /usr/sbin/autolog
  132.         0 22 * * * /usr/sbin/autolog
  133.         0  1 * * * /usr/sbin/autolog
  134.         
  135.  
  136. COMMAND LINE PARAMETERS:
  137.  
  138.     -a    (all processes) Print information on ALL utmp entries--not just
  139.         user processes.
  140.         
  141.     -d    (debug mode) This is helpful in setting up your configuration file.
  142.         The program runs in foreground rather than forking and it prints 
  143.         out verbose messages about what it is doing.
  144.  
  145.     -n  (nokill) Use this to prevent autolog from actually "killing"
  146.         anyone.  Use -d and -n together when setting up a new
  147.         configuration file.  
  148.        
  149.     -f  config_file_name
  150.         Use this to override the default: "/etc/autolog.conf"
  151.     
  152.     -l  log_file_name
  153.         Use this to override the default: "/usr/adm/logoutlog"
  154.         
  155.         Note that if this file doesn't exist, no logging will happen.
  156.         Create the file (with touch) to enable logging.
  157.     
  158.     -t  idle_time
  159.         Use this to override the internal default idle time (minutes)
  160.  
  161.     -g  grace_period
  162.         Use this to override the internal default grace period (seconds)
  163.     
  164.     -m  yes/no
  165.         Use this to override the internal mailing switch.  If "yes"
  166.         the program will send mail to the users right after killing them.
  167.  
  168.     -c  yes/no
  169.         Use this to override the internal "pre-clear" switch.  If "yes"
  170.         the program will clear the terminal screen before warning the user.
  171.  
  172.     -w  yes/no
  173.         If set to "no" no warning message will be printed to processes
  174.         about to be killed.
  175.  
  176.     -h  yes/no
  177.         Do timeouts based on total session time--not idle time. (hard)
  178.        
  179.     -L  yes/no
  180.         If set to "yes" activities will be written to the logfile if 
  181.         present.
  182.  
  183.  
  184. Bugs/Caveats:
  185. - The utmp file seems to only hold 8 characters worth of login name.
  186.   If your login name is shorter than this, note that autolog may only
  187.   see the first 8 characters.  This is screwing up the group search
  188.   function too.  This shouldn't be too hard to fix.  I'll
  189.   just have to derive the real login name from the pid or something...
  190.  
  191. - There is a feature that would be very helpful that autolog doesn't have
  192.   yet.  The ppp program generally creates a login process which is seen
  193.   by autolog.  The problem is that network activity does not change the
  194.   idle time on the tty controlled by ppp.  So there is no way (with the
  195.   existing code) for autolog to know if the network link has gone idle for
  196.   a period of time (it appears idle all the time--no matter what happens.
  197.  
  198.   So your choices are this:  You can leave ppp out of your 
  199.   "autolog strategy" in which case it will look like an idle shell and will
  200.   get killed.  Or, you can put it in the configuration file with an 
  201.   exemption (idle=0) in which case it will never get killed no matter what.
  202.  
  203.   If someone knows where I can snoop in the OS (in a portable way) to find
  204.   out how long its been since a ppp login passed any network traffic, I
  205.   would add a ppp switch to be used for this purpose.
  206.  
  207. - Due to the large changes to 0.30, I may have introduced a few problems.
  208.   Unfortunately this program is kind of difficult to test.  So please let me
  209.   know if you find problems and I'll try to fix 'em up.
  210.        
  211.  
  212. CHANGES:
  213. - 0.2:
  214.   Added 'hard' logout feature.  Several bug fixes.
  215.  
  216. - 0.21:
  217.   Added 'pre-clear' option.
  218.  
  219. - 0.30:
  220.   Rewrote the configuration file parser.  Added group matching and the
  221.   "nowarn" option.  Rewrote/cleaned up almost the whole program.
  222.  
  223. - 0.31:
  224.   Fixed bug with searching for group.  If the group could not be found 
  225.   from the username, the program would segmentation fault.  Hopefully fixed.
  226.  
  227.  
  228. Have fun knocking off those 'delinquent' users!  And don't let the power
  229. go to your head...
  230.  
  231. Kyle Bateman
  232. kyle@actarg.com
  233.